package game.gameloader;

import game.games.carcassonne.Carcassonne;
import game.games.chartest.CharTest;
import game.games.gol.GameOfLife;
import game.games.paint.Paint;
import game.games.rpg.RPG;
import game.util.Logger;
import javax.swing.JOptionPane;

public class GameLoader
{
    public static void main(String[] args)
    {
        Class<?>[] games = new Class<?>[] {
                Carcassonne.class,
                CharTest.class,
                GameOfLife.class,
                Paint.class,
                RPG.class
        };
        Class<?> clazz = (Class<?>) JOptionPane.showInputDialog(
                            null,
                            "Choose wisely padawan",
                            "Customized Dialog",
                            JOptionPane.PLAIN_MESSAGE,
                            null,
                            games,
                            null);
        try
        {
            Thread t = new Thread((Runnable) clazz.newInstance(), clazz.getSimpleName());
            t.start();
        }
        catch (Exception ex)
        {
            Logger.showExceptionError(ex);
        }
    }
}
